<template>
	<view>
		<top-tabbar tabTitle="明星列表" backColor="#5B2177" @backClick="backClick"></top-tabbar>
		<!-- 明星列表 -->
		<view class="main">
			<view class="celeb-list" v-for="(item,index) in celebList" :key="item.id">
				<view class="img-box">
					<image class="img" mode="aspectFill" src="@/static/home/celebrity.jpeg" v-if="!item.furl"></image>
					<image :src="item.furl" class="img" v-else></image>
				</view>
				<view class="first">{{item.nick}}</view>
				<view class="fans">{{item.fansCount}}粉丝</view>
				<view class="followed" :class="isFollow== 1 ? 'gray' : ''">关注</view>
			</view>
		</view>
	</view>
</template>

<script>
	import topTabbar from '@/components/top-tabbar.vue'
	import { $POST, $GET } from '@/network/api.js'
	export default {
		components: { topTabbar },
		data() {
			return {
				celebrityForm: { // 明星排行参数
					pageNum: 1,
					pageSize: 10,
					userId: 11
				},
				celebList: [] // 明星数据
			}
		},
		onLoad() {
			this.celebrity() // 明星排行
		},
		methods:{
			// 获取明星排行
			celebrity() {
				$POST( '/boke-item/channel/getStarZoneRank',this.celebrityForm).then(res => {
					this.celebList = res.data
				})
			},
			// 返回上一页
			backClick() {
				uni.switchTab({
					url: "/pages/home/index"
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		padding: 38rpx 25rpx 0 25rpx;
		display: flex;
		flex-wrap: wrap;
		.celeb-list:nth-child(3n) {
		 margin-right: 0 !important;
		}
		.celeb-list{
			width: 220rpx;
			// height: 321rpx;
			padding: 30rpx 0;
			background: #FFFFFF;
			// border: 1rpx solid rgba(0, 0, 0, 0.14);
			box-shadow: 0px 4rpx 7rpx 0px rgba(0, 0, 0, 0.14);
			border-radius: 5rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			margin: 0 20rpx 20rpx 0;
			.img-box{
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
				.img{
					width: 100%;
					height: 100%; 
					border-radius: 50%;
				}
			}
			.first{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				margin: 20rpx 0 17rpx 0;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 1;
				overflow: hidden;
			}
			.fans{
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
			}
			.followed{
				display: inline-block;
				padding: 8rpx 45rpx;
				background: linear-gradient(90deg, #B83DF1, #852CAE);
				border-radius: 25rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				margin-top: 20rpx;
			}
			.gray{
				background: #999999 !important;
			}
		}
	}
</style>
